package com.agynamix.scala.mi

import _root_.java.io.{IOException, File}
import _root_.javax.script.{ScriptEngineManager, ScriptException}

/**
 * Created by IntelliJ IDEA.
 * User: tuhlmann
 * Date: 05.04.2010
 * Time: 15:29:26
 * To change this template use File | Settings | File Templates.
 */

trait MediaFileProcessor {

  val mgr = new ScriptEngineManager()
  val scriptEngine = mgr.getEngineByName("AppleScript")

  def process(mediaFile: File): ITunesProcessResult

  def removeExtension(name: String): String = {
    var re = name
    val pos = name.lastIndexOf(".")
    if (pos > -1)
    {
      re = name.substring(0, pos)
    }
    return re
  }

  def isEmpty(str: String): Boolean = {
    return str == null || str.length == 0
  }

}